<?php
namespace app\ad\model;
/* *
 * 广告管理
 * */
class adlook extends \app\base\model\AdminModel{
    protected $table = 'ad_content';  //文章表

    //列表
    public function _select($condition){
        return $this->where($condition)->select();
    }

    //单个
    public function _find($condition){
        return $this->where($condition)->find();
    }

    //删除
    public function _delete($id){
        $rel = $this->table('ad_content')->where(array('ad' =>$id))->find();
        if($rel){
            return FALSE;
        }else{
            return $this->where(array('id' =>$id))->delete();
        }
        
    }  

    //编辑
    public function _update($data,$condition = NULL){
        if($condition){
            return $this->where($condition)->data($data)->update();
        }else{
            return $this->data($data)->insert();
        }
    }  
}